package com.qfmy.webapp.controller.novel;

import com.qfmy.common.result.Result;
import com.qfmy.model.vo.novel.NovelCategoryVo;
import com.qfmy.webapp.service.novel.NovelCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.web.app.controller.novel
 * @date 2025/10/31
 * @description 小说的类型
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/category")
public class NovelCategoryController {

    /**
     * 注入小说的类型服务
     */
    @Autowired
    private NovelCategoryService novelCategoryService;

    /**
     * 获取所有的分类
     */
    @GetMapping("/getAllCategoryName")
    public Result<List<NovelCategoryVo>> getAllCategoryName() {
        List<NovelCategoryVo> list = novelCategoryService.getAllCategoryName();
        return Result.ok(list);
    }

    /**
     * 根据类型获取所有的分类
     */
    @GetMapping("/getCategoryNameByType")
    public Result<List<NovelCategoryVo>> getCategoryNameByType(@RequestParam Integer type) {
        List<NovelCategoryVo> list = novelCategoryService.getCategoryNameByType(type);
        return Result.ok(list);
    }

    /**
     * 根据类型获取书籍的标签
     */
    @GetMapping("/getCategoryTagsByType")
    public Result<List<List<String>>> getCategoryTagsByType(@RequestParam Integer type) {
        List<List<String>> list = novelCategoryService.getCategoryTagsByType(type);
        return Result.ok(list);
    }


}
